#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <numeric>

using namespace std;

// 3487. 删除后的最大子数组元素和
// https://leetcode.cn/problems/maximum-unique-subarray-sum-after-deletion/description/?envType=daily-question&envId=2025-07-25

class Solution
{
public:
    int maxSum(vector<int> &nums)
    {
        set<int> ret;
        for (int i = 0; i < nums.size(); i++)
        {

            ret.insert(nums[i]);
        }
        while(ret.size() > 1){
            if(*ret.begin() < 0){
                ret.erase(ret.begin());
                continue;
            }
            break;
        }

        int ans = accumulate(ret.begin(), ret.end(), 0);
        return ans;
    }
};

int main()
{
    return 0;
}